<template>
  <div class="collect">
    <van-nav-bar
      title="我的收藏"
      left-text="返回"
      right-text="..."
      left-arrow
      @click-left="$router.go(-1)"
    />
    <div class="shoplist">
      <div @click="toDetail(item)" class="shop" v-for="(item,index) in collectlist" :key="index">
        <div class="imgdiv">
          <img :src="item.picUrl" alt="">
        </div>
        <div class="show">
          <span>{{item.name}}</span>
          <span> ☆ {{item.wmPoiScore}} {{item.monthSalesTip}}</span>
          <span>{{item.minPriceTip}} {{item.shippingFeeTip}}</span>
        </div>
      </div>
      <div v-if="collectlist.length == 0" class="empty">
        未收藏任何店铺,<span @click="$router.push('/index/home')">去逛逛</span>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
    computed:{
        ...mapState(['collectlist'])
    },
    methods:{
        toDetail(item){ 
            this.$router.push('/detail/'+item.mtWmPoiId);
        }
    }
}
</script>

<style lang='scss' scoped>
.shoplist{
  margin: 4vw;
  .shop{
    display: flex;
    margin: 4vw 0;
    .imgdiv{
      width: 22vw;
      margin-right: 4vw;
      img{
        width: 100%;
      }
    }
    .show{
      font-size: 4vw;
      span{
        display: block;
      }
    }
  }

  .empty{
    text-align: center;
    padding: 10vw 0;
    span{
        color: red;
    }
  }
}
</style>